package ebcs.scan.controller.systemCtr;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import ebcs.database.bean.BsNeedInfor;
import ebcs.database.bean.BsUserInfor;
import ebcs.database.bean.BsUserNeedRel;
import ebcs.database.service.SystemServiceImp;
import ebcs.database.service.impl.BsUserInforServiceImpl;
import ebcs.database.service.impl.BsUserNeedServiceImpl;
import jplat.core.trans.JAppBaseService;
import jplat.core.trans.JAppContext;
import jplat.core.trans.JAppContextFactory;
import jplat.error.exception.JSystemException;
import jplat.error.exception.JTransException;
import jplat.tools.string.JRandomUtil;
 

/***
 * 系统管理
 * @author chenzhuo
 * @comment
 */
@Controller
public class SystemManagerCtrl extends JAppBaseService
{
	private Logger logger = Logger.getLogger(SystemManagerCtrl.class);
	protected JAppContextFactory serviceFactory = new JAppContextFactory();
	//数据库库服务.
	@Autowired 
	public SystemServiceImp systemService ; 
  
	/**
	 * 拉去用户所属权限
	 */
	@RequestMapping("/page/need/selectFunction.do")
	public void selectFunction( HttpServletRequest request,HttpServletResponse response ) throws JTransException, JSystemException{
		JAppContext context = serviceFactory.buildAppContextWithUser(request,response);		//buildAppContextWithUser 自带客户信息.
		BsUserInfor user = context.getUserInfo();
		List funcList =  systemService.selectFunction(user);
 	 	Map rsModel = new HashMap();
 	 	rsModel.put("funcList", funcList);
  		context.buildAppResponse(rsModel);
	}
}
